<?php

namespace Common\Proxy;

use Common\Factory;
use Common\Interfaces\IUserProxy;

class UserProxy implements IUserProxy
{
    public function getUserName($id){
        $db = Factory::getDatabase('slave');
        $res = $db->query("SELECT name FROM `user` where id = $id LIMIT 1 ");
        return $res->fetchAll(\PDO::FETCH_ASSOC);
    }
    public function setUserName($id, $name){
        $db = Factory::getDatabase('master');
        return $db->query("UPDATE `user` set `name`= '$name' where id = $id LIMIT 1 ");
    }
}
